var express = require('express');
var router = new express.Router();
var employee = require('../../mock/employee')


router.get('/list', function (req, res) {

  var query = req.query;
  console.log(query);
  query.start = (query.current - 1) * query.pagesize;
  query.end = query.current * query.pagesize;

  console.log(employee.list(query));
  res.send(employee.list(query));

})


router.post('/save', function (req, res) {

  console.log("user:");
  console.log(req.body)
  var tip = '';

  if (req.body.emp_id > 0) {
    tip = 'add';
  } else {
    tip = 'update'
  }

  res.json({
    tip: tip,
    responseMsg: true
  })
})

router.post('/change', function (req, res) {
  var change = req.body;
  console.log("changeInfo:")
  console.log(change)
  res.json({
    responseMsg: true
  })
})

module.exports = router;

